//
// Created by Cammy on 2024/4/29.
//

#ifndef C_DATASTRUCT_TREE_H
#define C_DATASTRUCT_TREE_H

#include <stdio.h>
#include <malloc.h>
#include <stdbool.h>
#include <assert.h>
#include <stdlib.h>


typedef int BTDataType;
typedef struct BinaryTreeNode {
    struct BinaryTreeNode *left;
    struct BinaryTreeNode *right;
    BTDataType data;
} BTNode;

void PrevOrder(BTNode *root);

void InOrder(BTNode *root);

void PostOrder(BTNode *root);

int TreeSize(BTNode *root);

int TreeLeafSize(BTNode *root);

void LevelOrder(BTNode *root);

void DestroyTree(BTNode *root);

// ------------------------------------------------------------------------------------------------------

typedef BTNode* QDataType;

typedef struct QueueNode {
    QDataType data;
    struct QueueNode *next;
} QNode;

typedef struct Queue {
    QNode *head;
    QNode *tail;
} Queue;

void QueueInit(Queue *pq);

void QueueDestroy(Queue *pq);

// 队尾入
void QueuePush(Queue *pq, QDataType x);

// 队头出
void QueuePop(Queue *pq);

//取队头
QDataType QueueFront(Queue *pq);

//取队尾
QDataType QueueBack(Queue *pq);

int QueueSize(Queue *pq);

bool QueueEmpty(Queue *pq);

#endif //C_DATASTRUCT_TREE_H
